<%@ page import="com.walkingfiles.registry.Document" %>
<%@ page import="com.walkingfiles.registry.Area" %>

<div class="fieldcontain ${hasErrors(bean: documentInstance, field: 'number', 'error')} ">
	<label for="number">
		<g:message code="document.number.label" default="Number" />
		
	</label>
	<g:textField name="number" value="${documentInstance?.number}"/>
</div>


<div class="fieldcontain ${hasErrors(bean: documentInstance, field: 'type', 'error')} required">
	<label for="type">
		<g:message code="document.type.label" default="Type" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="type" name="type.id" from="${com.walkingfiles.registry.DocumentType.list()}" optionKey="id" optionValue="name" required="" value="${documentInstance?.type?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: documentInstance, field: 'date', 'error')} required">
	<label for="date">
		<g:message code="document.date.label" default="Date" />
		<span class="required-indicator">*</span>
	</label>
	<g:datePicker name="date" precision="day"  value="${documentInstance?.date}"  />
</div>


<div class="fieldcontain ${hasErrors(bean: documentInstance, field: 'subject', 'error')} required">
	<label for="subject">
		<g:message code="document.subject.label" default="Subject" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="subject" name="subject.id" from="${com.walkingfiles.registry.DocumentSubject.list()}" optionKey="id" optionValue="name" required="" value="${documentInstance?.subject?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: documentInstance, field: 'description', 'error')} ">
	<label for="description">
		<g:message code="document.description.label" default="Description" />
		
	</label>
	<g:textArea name="description" value="${documentInstance?.description}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: documentInstance, field: 'signer', 'error')} ">
	<label for="signer">
		<g:message code="document.signer.label" default="Signer" />
		
	</label>
	<g:textField name="signer" value="${documentInstance?.signer}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: documentInstance, field: 'signerType', 'error')} required">
	<label for="signerType">
		<g:message code="document.signerType.label" default="Signer Type" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="signerType" name="signerType.id" from="${com.walkingfiles.registry.SignerType.list()}" optionKey="id" optionValue="name" required="" value="${documentInstance?.signerType?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: documentInstance, field: 'sourceArea', 'error')} required">
	<label for="sourceArea">
		<g:message code="document.sourceArea.label" default="Source Area" />
		<span class="required-indicator">*</span>
	</label>
	<g:hiddenField name="sourceArea.id" value="${session.currentAreaId}"/>
	<span id="document">${Area.get(session.currentAreaId).name.encodeAsHTML() }</span>
</div>

<div class="fieldcontain ${hasErrors(bean: documentInstance, field: 'outbox', 'error')} ">
	<label for="outbox">
		<g:message code="document.outbox.label" default="Outbox" />
		
	</label>
	<g:checkBox name="outbox" value="${documentInstance?.outbox}" />
</div>

